package com.twt.recruit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.twt.recruit.entity.TimeHand;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.sql.Timestamp;

public interface TimeHandMapper extends BaseMapper<TimeHand> {

    @Select("select count(*) from time_hand where project_id = #{projectId} and day = #{day} and time_section = #{time}")
    Integer listTimeSectionCount(Integer projectId, Integer day, String time);


    @Select("select updated_time from time_hand where time_hand.project_id = #{projectId} order by updated_time desc limit 1")
    Timestamp getLatestTime(Integer projectId);
    @Select("select IFNULL(count(0), 0) as total from application where DATE_FORMAT(created_time,'%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')")
    Integer listNewApplicationCount(Integer projectId);

    @Delete("delete from time_hand where project_id = #{projectId}")
    void delTimeHandProjectId(Integer projectId);
}
